package io2;

import java.io.Serializable;
import java.util.Arrays;
import java.util.Objects;

public class Student implements Serializable {
    private int age;
    private String name;
    private String  gender;
    private  String[] otherinfo;



    public Student() { }

    public Student(int age, String name, String gender, String[] otherinfo) {
        this.age = age;
        this.name = name;
        this.gender = gender;
        this.otherinfo = otherinfo;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String[] getOtherinfo() {
        return otherinfo;
    }

    public void setOtherinfo(String[] otherinfo) {
        this.otherinfo = otherinfo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return age == student.age && name.equals(student.name) && gender.equals(student.gender) && Arrays.equals(otherinfo, student.otherinfo);
    }

    @Override
    public int hashCode() {
        int result = Objects.hash(age, name, gender);
        result = 31 * result + Arrays.hashCode(otherinfo);
        return result;
    }
    @Override
    public String toString() {
        System.out.println("tostring");
        return "Student{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", gender='" + gender + '\'' +
                ", otherinfo=" + Arrays.toString(otherinfo) +
                '}';
    }
}
